package com.ndp.fb.walle.permission.validation;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ndp.fb.rdb.api.DataPermissionRdbService;
import com.ndp.fb.walle.model.vo.targetingspectemplate.param.TargetingSpecTemplateParam;
import org.springframework.stereotype.Component;

/**
 * Created by yeahmobi on 2015/6/9.
 */
@Component
public class TargetingSpecTemplateControllerValidation {

    @Reference
    private DataPermissionRdbService dataPermissionRdbService;

    public boolean showTargetingSpecTemplate(String usertoken,Object [] args){
        TargetingSpecTemplateParam targetingSpecTemplateParam = com.alibaba.fastjson.JSON.parseObject(args[0].toString(), TargetingSpecTemplateParam.class);
        return  dataPermissionRdbService.userHasAccess(usertoken,"targeting_spec_template","interest_id",String.valueOf(targetingSpecTemplateParam.getId()));
    }
    //创建不需要检查
    public boolean createTargetingSpecTemplate(String usertoken,Object [] args){
        return  true;
    }
    //根据 usertoken 查询，不需要检查
    public boolean getTargetingSpecTemplatesByType(String usertoken,Object [] args){
        return  true;
    }
}
